package com.mofang.activity.interact;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.mofang.R;
import com.mofang.activity.BaseTitleViewActiviey;
import com.mofang.activity.MainActivity;

public class TaxCalculatorActivity extends BaseTitleViewActiviey implements
		OnClickListener {

	private LinearLayout taxcalculator_newHouseBtn_ly;// 新房按钮
	private LinearLayout taxcalculator_secondHandHouseBtn_ly;// 二手房按钮
	private LinearLayout taxcalculator_newHouse_ly;// 新房布局
	private LinearLayout taxcalculator_secondHandHouse_ly;// 二手房布局

	private LinearLayout taxcalculator_secondDutyWay_ly;// 计征方式
	private LinearLayout taxcalculator_secondHouseNature_ly;// 房屋性质

	private LinearLayout tax_calculator_startCal_ly;// 开始计算

	private EditText taxcalculator_newUnitPrice_edit;// 新房单价
	private EditText taxcalculator_newArea_edit;// 新房面积
	private EditText taxcalculator_secondArea_edit;// 二手房面积
	private EditText taxcalculator_secondTotalPrices_edit;// 二手房总价
	
	private TextView tap1;
	private TextView tap2;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_tax_calculator);
		setNavigationTitle("税费计算器");
		setNavigationLeftBtnImage(R.drawable.return_arrow);

		findView();

	}

	private void findView() {

		taxcalculator_newHouseBtn_ly = (LinearLayout) findViewById(R.id.taxcalculator_newHouseBtn_ly);
		taxcalculator_newHouseBtn_ly.setOnClickListener(this);

		taxcalculator_secondHandHouseBtn_ly = (LinearLayout) findViewById(R.id.taxcalculator_secondHandHouseBtn_ly);
		taxcalculator_secondHandHouseBtn_ly.setOnClickListener(this);

		taxcalculator_newHouse_ly = (LinearLayout) findViewById(R.id.taxcalculator_newHouse_ly);
		taxcalculator_newHouse_ly.setOnClickListener(this);

		taxcalculator_secondHandHouse_ly = (LinearLayout) findViewById(R.id.taxcalculator_secondHandHouse_ly);
		taxcalculator_secondHandHouse_ly.setOnClickListener(this);

		taxcalculator_newUnitPrice_edit = (EditText) findViewById(R.id.taxcalculator_newUnitPrice_edit);

		taxcalculator_newArea_edit = (EditText) findViewById(R.id.taxcalculator_newArea_edit);

		taxcalculator_secondArea_edit = (EditText) findViewById(R.id.taxcalculator_secondArea_edit);

		taxcalculator_secondTotalPrices_edit = (EditText) findViewById(R.id.taxcalculator_secondTotalPrices_edit);

		taxcalculator_secondDutyWay_ly = (LinearLayout) findViewById(R.id.taxcalculator_secondDutyWay_ly);
		taxcalculator_secondDutyWay_ly.setOnClickListener(this);

		taxcalculator_secondHouseNature_ly = (LinearLayout) findViewById(R.id.taxcalculator_secondHouseNature_ly);
		taxcalculator_secondHouseNature_ly.setOnClickListener(this);

		tax_calculator_startCal_ly = (LinearLayout) findViewById(R.id.tax_calculator_startCal_ly);
		tax_calculator_startCal_ly.setOnClickListener(this);

		tap1 = (TextView) findViewById(R.id.tv_tap1);
		tap2 = (TextView) findViewById(R.id.tv_tap2);
		
		taxcalculator_newHouseBtn_ly.performClick();
	}

	@Override
	public void onClick(View v) {

		Intent intent;
		switch (v.getId()) {

		case R.id.taxcalculator_newHouseBtn_ly:
			tap1.setTextColor(getResources().getColor(R.color.black_green));
			tap2.setTextColor(getResources().getColor(R.color.textColor3));
			taxcalculator_secondHandHouseBtn_ly.setBackgroundResource(R.drawable.syloanbtnbg);
			taxcalculator_newHouseBtn_ly.setBackgroundResource(R.drawable.gjjloanbtnbg_select);

			taxcalculator_newHouse_ly.setVisibility(View.VISIBLE);
			taxcalculator_secondHandHouse_ly.setVisibility(View.GONE);

			break;

		case R.id.taxcalculator_secondHandHouseBtn_ly:
			tap1.setTextColor(getResources().getColor(R.color.textColor3));
			tap2.setTextColor(getResources().getColor(R.color.black_green));
			taxcalculator_secondHandHouseBtn_ly.setBackgroundResource(R.drawable.gjjloanbtnbg_select);
			taxcalculator_newHouseBtn_ly.setBackgroundResource(R.drawable.syloanbtnbg);

			taxcalculator_newHouse_ly.setVisibility(View.GONE);
			taxcalculator_secondHandHouse_ly.setVisibility(View.VISIBLE);
			break;
		case R.id.taxcalculator_secondDutyWay_ly:

			intent = new Intent(getApplicationContext(), MainActivity.class);
			startActivity(intent);

			break;
		case R.id.taxcalculator_secondHouseNature_ly:

			intent = new Intent(getApplicationContext(), MainActivity.class);
			startActivity(intent);

			break;

		case R.id.tax_calculator_startCal_ly:
			intent = new Intent(getApplicationContext(),
					TaxCalculateResultActivity.class);
			startActivity(intent);
			break;

		default:
			break;
		}

	}

}
